package com.hnhegui.backend.platform.service.system;

import com.hnhegui.backend.entity.Result;
import com.hnhegui.backend.platform.convert.system.AuthConvert;
import com.hnhegui.backend.platform.vo.payment.request.LoginRequestVO;
import com.hnhegui.backend.platform.vo.payment.response.LoginResponseVO;
import com.hnhegui.backend.system.api.AuthRestApi;
import com.hnhegui.backend.system.dto.response.LoginResponseDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author 刘大海
 * @since 2025/10/27 11:37
 */
@Service
public class RestAuthService {

    @Autowired
    private AuthRestApi authRestApi;

    public LoginResponseVO login(LoginRequestVO request) {
        Result<LoginResponseDTO> login = authRestApi.login(AuthConvert.INSTANCE.convertRequest(request));
        return AuthConvert.INSTANCE.convertResponse(login.getData());
    }

    public void logout(Long userId) {
        authRestApi.logout(userId);
    }
}
